<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
  <head>
    <title></title>
	<link rel="stylesheet" type="text/css" href="${path}/css/main.css">
	<link rel="stylesheet" type="text/css" href="${path}/css/mainTable.css">
	<script type="text/javascript">
		function removeLimitCode(sp_code_id, province, sp_code){
			if(confirm("删除后无法恢复!你确定要删除吗?")){
				var actionUrl = "${path}/limitCode/deleteLimitCode.action";
				var params = "limitCodeVo.sp_code_id="+sp_code_id+"&limitCodeVo.province="+province+"&limitCodeVo.sp_code="+sp_code;
				params = encodeURI(params);
				params = encodeURI(params);
				window.location.href=actionUrl+'?'+params;
			}
		}
		
		function removeBusinessLimitCode(sp_code_id,sp_code){
			if(confirm("删除后无法恢复!你确定要删除吗?")){
				var actionUrl = "${path}/limitCode/deleteBusinessLimitCode.action";
				var params = "limitCodeVo.sp_code_id="+sp_code_id+"&limitCodeVo.sp_code="+sp_code;
				params = encodeURI(params);
				params = encodeURI(params);
				window.location.href=actionUrl+'?'+params;
			}
		}
		
	</script>
  </head>
  <body>
    <div>
    	<p>新增短号码省份管控配置 <a href="${path }/limitCode/addLimitCode.action" title="添加短号码省份管控配置">添加</a></p>
    	<div>
    		<table>
    			<thead>
    				<tr>
    					<th>编号</th>
    					<th>业务短号码</th>
    					<th>省份</th>
    					<th>日限(元)</th>
    					<th>月限(元)</th>
    					<th>月计费(元)</th>
    					<th>省份操作</th>
    					<th>短号码操作</th>
    				</tr>
    			</thead>
    			<c:choose>
    				<c:when test="${limitCodeMapVoList != null && fn:length(limitCodeMapVoList) > 0}">
    					<c:forEach var="limitCodeMapVo" items="${limitCodeMapVoList }" varStatus="list">
    						<c:if test="${limitCodeMapVo.limitCodeVoList != null && fn:length(limitCodeMapVo.limitCodeVoList) > 0 }">
    							<c:forEach var="limitCodeVo" items="${limitCodeMapVo.limitCodeVoList }" varStatus="i">
    								<c:choose>
    									<c:when test="${i.index == 0 }">
    										<tr style="${list.index%2 != 0 ? 'background-color: #fea;' : 'background-color: #fff;' }" >
				    							<td rowspan="${fn:length(limitCodeMapVo.limitCodeVoList) }">${list.index + 1 }</td>
				    							<td rowspan="${fn:length(limitCodeMapVo.limitCodeVoList) }">
				    								<a href="${path }/limitCode/modifyBusinessLimitCode.action?limitCodeVo.sp_code_id=${limitCodeMapVo.sp_code_id }">${limitCodeMapVo.sp_code }</a>
				    							</td>
				    							<td>
				    								<a href="${path }/limitCode/modifyLimitCode.action?limitCodeVo.sp_code_id=${limitCodeMapVo.sp_code_id }&limitCodeVo.province=${limitCodeVo.province }">${limitCodeVo.province }</a>
				    							</td>
				    							<td>${limitCodeVo.day_limit }</td>
				    							<td>${limitCodeVo.month_limit }</td>
				    							<td>${limitCodeVo.month_used }</td>
				    							<td>
				    								<a href="javascript:removeLimitCode(${limitCodeVo.sp_code_id },'${limitCodeVo.province }','${limitCodeMapVo.sp_code }');">删除</a>
				    							</td>
				    							<td rowspan="${fn:length(limitCodeMapVo.limitCodeVoList) }">
				    								<a href="javascript:removeBusinessLimitCode(${limitCodeVo.sp_code_id }, '${limitCodeMapVo.sp_code }');">删除</a>
				    							</td>
				    						</tr>
    									</c:when>
    									<c:otherwise>
    										<tr style="${list.index%2 != 0 ? 'background-color: #fea;' : 'background-color: #fff;' }" >
				    							<td>
				    								<a href="${path }/limitCode/modifyLimitCode.action?limitCodeVo.sp_code_id=${limitCodeMapVo.sp_code_id }&limitCodeVo.province=${limitCodeVo.province }">${limitCodeVo.province }</a>
				    							</td>
				    							<td>${limitCodeVo.day_limit }</td>
				    							<td>${limitCodeVo.month_limit }</td>
				    							<td>${limitCodeVo.month_used }</td>
				    							<td><a href="javascript:removeLimitCode(${limitCodeVo.sp_code_id },'${limitCodeVo.province }','${limitCodeMapVo.sp_code }');">删除</a></td>
				    						</tr>
    									</c:otherwise>
    								</c:choose>
    							</c:forEach>
    						</c:if>
    					</c:forEach>
    				</c:when>
    				<c:otherwise>
    					<tr>
    						<td>暂无短号码省份管控配置<td>
    					</tr>
    				</c:otherwise>
    			</c:choose>
    		</table>
    	</div>
    </div>
  </body>
</html>
